class Postoffice < ActionMailer::Base
  helper :application
  
  EMAIL_ROBOT = "alert@aramid.it"
  
  def resoconto(client, assistance, intern)
    if intern
      @recipients = EMAIL_ROBOT
      body[:short_desc] = assistance.short_desc # Per aggiungere il campo solo nel report interno
    else
      @recipients = client.email
    end
    @from         = EMAIL_ROBOT
    @subject      = "Helpdesk BENASSI SRL, assistenza a " + client.name_or_society + ", " + Time.now.to_s(:short)
    @sent_on      = Time.now
    @content_type = "text/html"

    body[:operator]  = assistance.operator.login
    body[:assistance] = assistance
  end
  
  def open_ticket(client, assistance)
    @recipients   = "globe@network7.eu"
    @from         = EMAIL_ROBOT
    @subject      = "#" + assistance.typology + " - [" + client + "] - " + assistance.short_desc
    @sent_on      = Time.now
    @content_type = "text/plain"
    @body         = ""
  end
  
  def scadenza_av(email, name_machine, days)
    @recipients   = email
    @from         = EMAIL_ROBOT
    @cc           = "alert@aramid.it"
    @subject      = "BENASSI SRL - MDS/MSS avviso relativo a macchina [" + name_machine + "] - data, " + Time.now.to_s(:short)
    @sent_on      = Time.now
    @content_type = "text/html"

    body[:name_machine]  = name_machine
    body[:days] = days
  end
end
